const data = {
  'name': 'analytics',
  'children': [
   {
    'name': 'cluster',
    'children': [
     {'name': 'AgglomerativeCluster', 'size': 3938},
     {'name': 'CommunityStructure', 'size': 3812},
     {'name': 'HierarchicalCluster', 'size': 6714},
     {
       'name': 'MergeEdge', 'size': 743,
       'children': [
        {'name': 'AspectRatioBanker', 'size': 7074},
       ],
      },
    ],
   },
   {
    'name': 'graph',
    'children': [
     {'name': 'BetweennessCentrality', 'size': 3534},
     {'name': 'LinkDistance', 'size': 5731},
     {'name': 'MaxFlowMinCut', 'size': 7840},
     {'name': 'ShortestPaths', 'size': 5914},
     {'name': 'SpanningTree', 'size': 3416},
    ],
   },
   {
    'name': 'optimization',
    'children': [
     {'name': 'AspectRatioBanker', 'size': 7074},
    ],
   },
  ],
 };
 function addLevel(data, level) {
  if (!data) {
    return;
  }
  data.layer = level;

  data.children && data.children.forEach(element => {
    addLevel(element, level + 1);
  });

  return data;
}

addLevel(data, 0);

export default data;
